package it.sd.pwframework.persistence.common;



import java.io.Serializable;
import java.util.Collection;

import javax.persistence.EntityNotFoundException;

import org.hibernate.SQLQuery;

public interface DaoGeneric<K extends Serializable, E> {

	public abstract void persist(E entity);

	public abstract void delete(E entity);

	public abstract E merge(E entity);

	public abstract void refresh(E entity);

	public abstract E findById(K id);
	
	public abstract E findByIdCheckExists(K id) throws EntityNotFoundException;
	
//	public abstract PaginatedResults<?> findByNamedParams(final String query, final Map<String, Object> params, final Pagination pagination);
//	
//	public abstract PaginatedResults<?> findByNamedParams(String query, String[] paramsNames, Object[] paramsValues, Pagination pagination);
//	
//	public abstract PaginatedResults<?> findByNamedParam(String query, String paramName, Object paramValue, Pagination pagination);

	public abstract E flush(E entity);

	public abstract PaginatedResults<E> findAll();

	public abstract Integer removeAll();
	
	public abstract void flush();

	public abstract <T> PaginatedResults<T> getPaginatedResultFromCollection(Collection<T> collection, Pagination pagination);
	
	public abstract SQLQuery createNativeQuery(String sqlQuery);
}
